﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
using GBlastImaging;
using Cursor = System.Windows.Forms.Cursor;
using MouseEventArgs = System.Windows.Forms.MouseEventArgs;

namespace DriveBeamEditor.Controls.General
{
    public partial class DonateButton : UserControl
    {
        #region Fields

        public static readonly string DonateUrl =
            @"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6DNN2D63AU93U";

        private bool _startInExternalBrowser = true;

        #endregion

        #region Properties

        public bool StartInExternalBrowser
        {
            get { return _startInExternalBrowser; }
            set { _startInExternalBrowser = value; }
        }

        #endregion

        #region CTORs

        public DonateButton()
        {
            InitializeComponent();
        }

        #endregion

        #region Events

        protected override void OnClick(EventArgs e)
        {
            if (!StartInExternalBrowser)
                base.OnClick(e);
        }

        private void DonateButton_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (StartInExternalBrowser)
                    Process.Start(DonateUrl);
            }
        }

        private void openInDefaultBrowserItem_Click(object sender, EventArgs e)
        {
            Process.Start(DonateUrl);
        }

        private void openWithinTheEditorItem_Click(object sender, EventArgs e)
        {
            base.OnClick(e);
        }

        #endregion
    }
}
